@layout("/common/_curd/_container.html"){

<script type="text/javascript">
	var ctx = "${basePath}";
	var grid_selector = "#grid-table";
	var pager_selector = "#grid-pager";
	
	$(function(){
		initGrid();
		initMenuBtn("btns", "${code}");
	});
	
	function initGrid(){
		var grid_url = ctx + "/myproject/setss";
		var _colnames = ["年度",
						"项目名称", 
						"申报单位", 
						"责任单位",
						"项目状态",
						"立项编号",
						"操作"];
		var _colmodel = [{name:"indate", index:"indate", width:100,formatter: function (value,row,index) {
						var year = "未填入"
						if(value !== null){
							 year = value.substr(0,4);
						}
							return year;
						}},
						{name:"name", index:"name", width:100,formatter:function (value, row, index) {
							return '<a href="#" class="btn btn-btn btn-info btn-xs" onclick="view('+"'"+index.id+"'"+')">'+value+'</a>';
						}},
						{name:"fullname", index:"dept_id", width:100},
						{name:"responsible", index:"responsible", width:100},
						{name:"dict", width:100,index:"status"},
						{name:"plan", width:100,index:"plan"},
						{name:"temarks", width:200,formatter: function (value,row,index) {
							if(index.plan===null){
								return '<a href="#" class="btn btn-btn btn-success btn-xs" onclick="Listcomview('+"'"+index.id+"'"+')">'+"查看"+'</a> ' +
										'&nbsp;<a href="#" class="btn btn-btn btn-success btn-xs" onclick="handle1('+"'"+index.id+"'"+')">'+"立项操作"+'</a> ' +
										'&nbsp;<a href="#" class="btn btn-btn btn-success btn-xs" onclick="Listcomback('+"'"+index.id+"'"+')">'+"退回"+'</a>';
							}else {
								if(index.status ===13){
									return '<a href="#" class="btn btn-btn btn-success btn-xs" onclick="Listcomview('+"'"+index.id+"'"+')">'+"查看"+'</a> ' +
											'&nbsp;<a href="#" class="btn btn-btn btn-success btn-xs" onclick="handle2('+"'"+index.id+"'"+')">'+"重填立项信息"+'</a> ' +
											'&nbsp;<a href="#" class="btn btn-btn btn-success btn-xs" onclick="tohandle('+"'"+index.id+"'"+')">'+"上传招标文件"+'</a>';
								}else if(index.status === 14){
									return '<a href="#" class="btn btn-btn btn-success btn-xs" onclick="Listcomview('+"'"+index.id+"'"+')">'+"查看"+'</a> ' +
											'&nbsp;<a href="#" class="btn btn-btn btn-success btn-xs" onclick="handle2('+"'"+index.id+"'"+')">'+"重填立项信息"+'</a> ' +
											'&nbsp;<a href="#" class="btn btn-btn btn-success btn-xs" onclick="tohandle('+"'"+index.id+"'"+')">'+"上传招标文件"+'</a>';
//									return '<a href="#" class="btn btn-btn btn-success btn-xs" onclick="Listcomview('+"'"+index.id+"'"+')">'+"查看"+'</a> ' +
//											'&nbsp;<a href="#" class="btn btn-btn btn-success btn-xs" onclick="handle1('+"'"+index.id+"'"+')">'+"立项操作"+'</a> ' +
//											'&nbsp;<a href="#" class="btn btn-btn btn-success btn-xs" onclick="Listcomback('+"'"+index.id+"'"+')">'+"退回"+'</a>';
								}else if(index.status === 15){
									return '<a href="#" class="btn btn-btn btn-success btn-xs" onclick="Listcomview('+"'"+index.id+"'"+')">'+"查看"+'</a> ' +
											'&nbsp;<a href="#" class="btn btn-btn btn-success btn-xs" onclick="handle2('+"'"+index.id+"'"+')">'+"填写合同"+'</a> ';
								}else if(index.status === 16){
									return '<a href="#" class="btn btn-btn btn-success btn-xs" onclick="gov('+"'"+index.id+"'"+')">'+"政务云操作"+'</a> ' ;
								}else{
									return "";
								}

							}

						}}];
		
		jQuery(grid_selector).jqGrid({
			url : grid_url,
		    shrinkToFit : true,
			colNames : _colnames,
			colModel : _colmodel, 
			jsonReader : {id :"id"},
			pager : pager_selector,
			postData : {sort : "id", order : "desc"}
		});
	}
	Listcomview = function (entId) {
		var index = layer.open({
			type: 2,
			title:'查看项目详情',
			area: ['90%', '70%'],
			maxmin:true,
			shadeClose: true, //点击遮罩关闭
			content:  '/projects/view?id='+ entId
		});

		this.layerIndex = index;
	};
	handle1 = function (entId) {
		window.location.href="/listcom/handle?id="+ entId;
	};
	gov = function (entId) {
		window.location.href="/cloud/";
	};
	handle2 = function (entId) {
		window.location.href="/contract/add?id="+ entId;
	};

	Listcomback = function (entId) {
		window.location.href="/projects/back?id="+ entId;
	};
	tohandle = function (entId) {
		window.location.href="/listcom/tohandle?id="+ entId;
	};
	function view(pid){
		var index = layer.open({
			type: 2,
			title:'查看详情',
			area: ['90%', '70%'],
			maxmin:true,
			shadeClose: true, //点击遮罩关闭

			content:  '/projects/view?id=' + pid
		});

		this.layerIndex = index;
	}
</script>


	<!-- 配置 grid -->
	<div class="row">
		<div class="col-xs-12 tb-grid">
			<!-- 配置 查询 -->
			@ var _col=[
@		{name:"主键", index:"id", type:"text"},
			@		{name:"项目名称", index:"name", type:"text"},
			@		{name:"申报单位", index:"dept_id", type:"text"},
			@		{name:"联系人", index:"contact", type:"text"},
			@		{name:"联系电话", index:"phone", type:"text"},
			@		{name:"邮箱", index:"email", type:"text"},
			@		{name:"填报日期", index:"indate", type:"text"},
			@		{name:"建设规模及主要建设内容", index:"introduction", type:"text"},
			@		{name:"责任单位", index:"responsible", type:"text"},
			@		{name:"建设性质", index:"nature", type:"text"},
			@		{name:"预算（万）", index:"budget", type:"text"},
			@		{name:"预算来源", index:"Source", type:"text"},
			@		{name:"完成投资（万）", index:"Completion", type:"text"},
			@		{name:"工程形象进度", index:"progress", type:"text"},
			@		{name:"计划投资（万）", index:"plan_budget", type:"text"},
			@		{name:"至年底工程形象进度", index:"plan_progress", type:"text"},
			@		{name:"备注", index:"temarks", type:"text"},
			@		{name:"审核状态", index:"status", type:"text"}
			@];
			@ include("/common/_function/_search.html",{"col":_col}){}
			<!-- 按钮 -->
			<div class="welljq well-sm" id="btns"></div>
			<!-- grid -->
			<table id="grid-table"></table>
			<!-- 分页-->
			<div id="grid-pager"></div>
		</div>
	</div>
	
	<!-- 引入所需的js -->
	@include("/common/_listscript.html"){}
	
@}	